/*
let name = "along";
let age = 32;
let obj = {
    name, // name:name
    age, // age:age
    fun() {  // fun:function() {}  fun:()=>{}

    }
};
console.log(obj);
*/
/*console.log(NaN === NaN);
console.log(Object.is(NaN,NaN)); // true
let arr = [4,6,NaN,54,4,NaN];
let res = [];
arr.forEach((item=>{
    /*
    if (!res.includes(item)) {
        res.push(item);
    }
   let bool = true;
   for(let i=0; i<res.length; i++) {
      if(Object.is(res[i],item)) {
          bool = false;
      }
   }
   if(bool) {
       res.push(item);
   }
}));
console.log(res);
*/
// Object.assign() 合并对象
let o1 = {
    a: 10
};
let o2 = {
    b:20
};
let obj = Object.assign(o1,o2);
console.log(obj);
console.log(obj === o1); //true

// 
let o1 = {
    a: 10,
    b: 25,
    c: 30
};
let o2 = {
    b:20,
    __proto__:o1,
    getB() {
        return super.b;
    }
};
//o2.__proto__ = o1; // o2的原型设置成o1
Object.setPrototypeOf(o2,o1);
console.log(o2.c);
console.log(Object.getPrototypeOf(o2));
console.log(o2.getB());


let obj = {
    name: "zs",
    age: 19
};
console.log(Object.keys(obj));// ["name","age"]
console.log(Object.values(obj));// ["zs",19]
console.log(Object.entries(obj));

let str = "abc";
let res = Object.getOwnPropertyDescriptor(str,"length");
let res2 = Object.getOwnPropertyDescriptor([1,2],"length");
let res3 = Object.getOwnPropertyNames(obj,"length");
console.log(res3);
